package com.study.vo;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.sql.Timestamp;

@Entity
public class Lend {
    private String bookId;
    private int id;
    private String isbn;
    private String bookName;
    private Timestamp ltime;
    private String readerId;

    @Basic
    @Column(name = "bookId", nullable = true, length = 11)
    public String getBookId() {
        return bookId;
    }

    public void setBookId(String bookId) {
        this.bookId = bookId;
    }

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "isbn", nullable = true, length = 255)
    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    @Basic
    @Column(name = "bookName", nullable = true, length = 255)
    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    @Basic
    @Column(name = "ltime", nullable = true)
    public Timestamp getLtime() {
        return ltime;
    }

    public void setLtime(Timestamp ltime) {
        this.ltime = ltime;
    }

    @Basic
    @Column(name = "readerId", nullable = true, length = 50)
    public String getReaderId() {
        return readerId;
    }

    public void setReaderId(String readerId) {
        this.readerId = readerId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Lend lend = (Lend) o;

        if (id != lend.id) return false;
        if (bookId != null ? !bookId.equals(lend.bookId) : lend.bookId != null) return false;
        if (isbn != null ? !isbn.equals(lend.isbn) : lend.isbn != null) return false;
        if (bookName != null ? !bookName.equals(lend.bookName) : lend.bookName != null) return false;
        if (ltime != null ? !ltime.equals(lend.ltime) : lend.ltime != null) return false;
        if (readerId != null ? !readerId.equals(lend.readerId) : lend.readerId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = bookId != null ? bookId.hashCode() : 0;
        result = 31 * result + id;
        result = 31 * result + (isbn != null ? isbn.hashCode() : 0);
        result = 31 * result + (bookName != null ? bookName.hashCode() : 0);
        result = 31 * result + (ltime != null ? ltime.hashCode() : 0);
        result = 31 * result + (readerId != null ? readerId.hashCode() : 0);
        return result;
    }
}
